package com.monkey.luffer.springboot.demo.basis.thread;

import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.concurrent.ExecutorService;

/**
 * @Author: dengkaibing
 * @Description: 线程池
 * @Date: 2020/12/18 16:32
 * @company 甜橙金融
 * @Version: 1.0
 */
    public class TaskExecutors {

        @Getter
        private static ExecutorService executorService;

        /**
         *初始化线程池
         * @param executorServices ExecutorService
         */
        public static void initThreadExecutor(ExecutorService executorServices) {
            executorService = executorServices;
        }

        /**
         * 线程池执行任务
         * @param active Runnable
         */
        public static void executeTask(Runnable active) {
            executorService.execute(active);
    }

}
